package cn.iocoder.yudao.module.security.dal.mysql.communicate;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.communicate.SecurityCommunicateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.communicate.vo.*;

/**
 * 通信行为 Mapper
 *
 * @author cai
 */
@Mapper
public interface SecurityCommunicateMapper extends BaseMapperX<SecurityCommunicateDO> {

    default PageResult<SecurityCommunicateDO> selectPage(SecurityCommunicatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SecurityCommunicateDO>()
                .eqIfPresent(SecurityCommunicateDO::getIpAddress, reqVO.getIpAddress())
                .eqIfPresent(SecurityCommunicateDO::getUpStream, reqVO.getUpStream())
                .eqIfPresent(SecurityCommunicateDO::getDownStream, reqVO.getDownStream())
                .eqIfPresent(SecurityCommunicateDO::getSuccessConnection, reqVO.getSuccessConnection())
                .eqIfPresent(SecurityCommunicateDO::getErrorConnection, reqVO.getErrorConnection())
                .eqIfPresent(SecurityCommunicateDO::getDeviceStatus, reqVO.getDeviceStatus())
                .betweenIfPresent(SecurityCommunicateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SecurityCommunicateDO::getId));
    }

}